package com.zhongkun.datahome.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhongkun.datahome.common.annotation.Excel;
import com.zhongkun.datahome.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.Date;

/**
 * 商户用户对象 tenant_user
 * 
 * @author ruoyi
 * @date 2025-04-14
 */
@Data
@NoArgsConstructor
public class TenantUser implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** id */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 用户id */
    @Excel(name = "用户id")
    private Long userId;

    /** 状态 0：启用 1：停用
     * @see com.zhongkun.datahome.common.enums.TenantUserStatusEnum
     * */
    private Integer status;

    /** 删除标识 默认：0，删除：1 */
    @TableLogic
    private Integer delFlag;

    /** 创建者 */
    @TableField(fill = FieldFill.INSERT)
    private Long createBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @TableField(fill = FieldFill.UPDATE)
    private Long updateBy;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    /** 租户ID */
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;

    @TableField(exist = false)
    private String userName;

    public TenantUser(Long userId, Long tenantId) {
        this.userId = userId;
        this.tenantId = tenantId;
    }

    public TenantUser(Long id, Long userId, Long tenantId) {
        this.id = id;
        this.userId = userId;
        this.tenantId = tenantId;
    }
}
